<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<p:panel id="pnCondicao" style="border: none;">

	<h:panelGrid columns="4" cellpadding="2">
		<h:outputText value="Condicao " />
		<h:outputText value="" />
		<h:outputText value="" />
		<h:outputText value="" />

		<p:inputText id="pFinalizaVendaIdCondicao"
			value="#{beanVenda.venda.condPagamento.id}" maxlength="40" size="5">
			<p:ajax event="change" listener="#{beanVenda.hotFindCondicao}"
				process="@this" update="pFinalizaVendaCondicao" />
		</p:inputText>
		<p:inputText id="pFinalizaVendaCondicao"
			value="#{beanVenda.venda.condPagamento.descricao}" size="68"
			disabled="true" binding="#{beanVenda.condPagamento}" />
		<p:commandButton id="pFinalizaVendaSelectCond" icon="ui-icon-search"
			title="Selecionar Condicao de Pagamento"
			onclick="dConsultaCondP.show() " />

		<p:commandButton id="pFinalizaVendaGerar" icon="ui-icon-check"
			value="Gerar" action="#{beanVenda.geraConta}"
			update="pFinalizaVendaParcelas" />
	</h:panelGrid>

	<br></br>
	<p:separator />

	<br></br>
	<p:panel style="border:none;" id="pFinalizaVendaParcelas">
		<p:dataTable value="#{beanVenda.contas}" var="conta"
			emptyMessage="Não há parcelas">
			<p:column headerText="Parcelas" width="15">
				<h:outputText value="#{conta.numero}" />
			</p:column>
			<p:column headerText="Vencimento">
				<h:outputText value="#{conta.vencimento}">
					<f:convertDateTime pattern="dd/MM/yyyy" />
				</h:outputText>
			</p:column>
			<p:column headerText="Valor">
				<h:outputText value="#{conta.valor}">
					<f:convertNumber minFractionDigits="2" />
				</h:outputText>
			</p:column>
			<p:column headerText="Data de Recebimento">
				<h:outputText value="#{conta.dataRecebimento}" />
			</p:column>
		</p:dataTable>
	</p:panel>
	<br></br>
	<p:separator />

	<h:panelGrid columns="3" style="float: right;">
		<p:commandButton id="pFinalizaVendaSalvar" value="Salvar"
			oncomplete="dCondVenda.hide()" action="#{beanVenda.save}"
			update="form" />
		<p:commandButton id="pFinalizaVendaLimpar" value="Limpar" type="reset" />
		<p:commandButton id="pFinalizaVendaVoltar" value="Voltar"
			onclick="dCondVenda.hide()" />
	</h:panelGrid>

</p:panel>

</html>